package edu.yuhf.web.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import edu.yuhf.dao.iface.NativePlaceDao;
import edu.yuhf.domain.NativePlace;

@Controller
public class NativePlaceController {

	@Resource
	NativePlaceDao nativePlaceDao;
	
	@ResponseBody
	@RequestMapping(value="/npCity")
	public Map<String,Object> nativePlaceCity(@RequestParam(name="code") String code){
		Map<String,Object> map=new HashMap<String,Object>();
		List<NativePlace> list=nativePlaceDao.getCities(code);
		map.put("result","success");
		map.put("list", list);
		return map;		
	}
	
	@ResponseBody
	@RequestMapping(value="/npInit")
	public Map<String,Object> nativePlaceInit(){
		Map<String,Object> map=new HashMap<String,Object>();
		List<NativePlace> list=nativePlaceDao.getProvinces();
		map.put("result","success");
		map.put("list", list);
		return map;
	}
}
